/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ueb17;

/**
 *
 * @author steffenschuhmann
 */
public class HashNode implements Nameable {

    private Object data;
    private HashNode next;
    
    public HashNode(Object data) throws NotNameblaException {
        if(data == null)
            throw new NullPointerException();
        if(!(data instanceof Nameable))
            throw new NotNameblaException();
        
        this.data = data;
    }
    
    public HashNode(Object data, HashNode next) {
        if(data == null)
            throw new NullPointerException();
        if(next == null)
            throw new NullPointerException();
        
        this.data = data;
        this.next = next;
    }
    
    public void setNext(HashNode next) {
        if(next == null)
            throw new NullPointerException();
        this.next = next;
    }
    
    public Object getData() {
        return data;
    }
    
    public HashNode getNext() {
        if(next == null)
            return null;
        return next;
    }  
    
    public boolean hasNext() {
        if(next == null)
            return false;
        return true;
    }
    
    @Override
    public String getName() {
        return ((Nameable) data).getName();
    }
}
